<template>
  <div>
    <div class="maintop">
      <i class="mintui mintui-back" @click="$router.go(-1)"></i>
      <span class="record">查看团队</span>
    </div>
    <div class="tree-wrap" v-if="ztreeDataSource.length>0">
      <vue-ztree
        :list.sync="ztreeDataSource"
        :func="nodeClick"
        :expand="null"
        :contextmenu="contextmenuClick"
        :is-open="true"
      ></vue-ztree>
    </div>
  </div>
</template>

<script>
import vueZtree from "vue-ztree/src/components/vue-ztree";
export default {
  components: {
    vueZtree
  },
  data() {
    return {
      ztreeDataSource:[]
    };
  },
  created() {
    this.getGroupDate();
  },
  methods: {
    // 点击节点
    nodeClick: function(m) {
      // console.log(JSON.parse(JSON.stringify(m)));
    },
    // 右击事件
    contextmenuClick: function() {
      // console.log("触发了自定义的contextmenuClick事件");
    },
    async getGroupDate() {
      const userid = JSON.parse(localStorage.getItem("localdata")).uuid;
      let groupRes = await this.$http.post(
        "/sys/partner/userteam",
        this.$qs.stringify({
          userId: userid
        })
      );
      this.ztreeDataSource = groupRes.data.data
      
    }
  }
};
</script>
<style lang="scss" scoped src="./styles/index.scss">
</style>